package chapter1.shallowCopy.src.com.kkb.tz.test;

public class Person implements Cloneable {
    public String name;
    public int age;
    public Address address;

    public Person() {}

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
        this.address = new Address();
    }



    @Override
    public Object clone() throws CloneNotSupportedException {
        // 直接调用父类的clone()方法
        return super.clone();
    }

    public void setAddress(String provinces, String city) {
        address.setAddress(provinces, city);
    }

    public void display(String name) {
        System.out.println(name + ":" + "name=" + this.name + ", age=" + age + "," + address);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

}
